<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/css/default.css" />

<script src="${pageContext.request.contextPath}/js/jquery-1.2.6.min.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/js/jquery.floatbox.10.4.min.js" type="text/javascript"></script>
<script language="JavaScript">

$(document).ready(function(){
	
	$("#Previous").click(function(){
	       
        $("#maintaincustomers_currentPage").val($("#maintaincustomers_currentPage").val()-1);
           
         $("form").submit();
      });
      
       $("#Next").click(function(){
 
        $("#maintaincustomers_currentPage").val(parseInt($("#maintaincustomers_currentPage").val())+1);
           
         $("form").submit();
      });
      
      $("#delete").click(function(){
        var checkboxes=$("input[type='checkbox']");
          var j=0;
         for(var i=0;i<checkboxes.length;i++){
             if(checkboxes[i].checked==true)
             j++;
         }
         if(j==0){
          alert("please select a record!");
          return false;
          }
         $("form").attr("action","deleteServer");
         $("form").submit();
      });
      
      $("#selectAll").click(function(){
        var checkboxes=$("input[type='checkbox']");
       
         for(var i=0;i<checkboxes.length;i++){
             checkboxes[i].checked=this.checked;        
         }
      });
      
});
</script>
<script language="JavaScript">

$(document).ready(function(){
	$(".editNewsValue").click(function () {
	    $.floatbox({
	        ajax: {
	            url: "editNewsValue.action?newsValueId="+$(this).attr('id'),
	          //  params: "codeValueId="+$(this).attr('id'), //post parameters
	            before: "<p>Loading content</p>", //loading message while the request is being processed
	            finish: function () {
	               
	            }
	        },
	        fade: true
	    });
	});
});
</script>
<meta content="180" http-equiv="refresh">
<title>客户管理</title>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
<s:form action="maintaincustomers" theme="simple">
	<s:hidden name="currentPage"></s:hidden>
	<table width="100%" border="0" cellpadding="2" cellspacing="1" bgcolor="#336600">
    	<tr> 
      		<td width="100%" bgcolor="#669900"><strong><font color="#FFFFFF">客户管理</font></strong></td>
    	</tr>
    	<tr align="center" bgcolor="#F9F9F9"> 
      		<td>
      			<table height="0%" width="98%" cellspacing="1" cellpadding="3" border="0">
          			<tr>
          				<td colspan="7">
          					<table>
          						<tr>
			          				<td colspan="2">　 
						              	<input type="button" name="Submit22" value="添加客户" onClick="location='addcustomer.action';"> 
						              	<input type="submit" name="Submit3" value="删除所选 ">
						            </td>
			            			<td height="40" colspan="5"> 　 选择分类 
			              				<select name="selClass" id="selClass">
			                				<option value="">所有分类</option>
							                <s:iterator value="newsType" var="value" status="stut">
							                	<option value=""><s:property value="chvalue" /></option>
							                </s:iterator>
			              				</select>
			            			</td>	
			            		</tr>
	            			</table>
	            		</td>
          			</tr>
		          	<tr bgcolor="#669900"> 
			            <td align="right"><font color="#FFFFFF">&nbsp;</font></td>
			            <td><font color="#FFFFFF"><strong>名称</strong></font></td>  
			            <td><font color="#FFFFFF"><strong>公司</strong></font></td> 
			            <td><font color="#FFFFFF"><strong>职位</strong></font></td>      
			            <td width="15%" align="center"><font color="#FFFFFF"><strong>操作</strong></font></td>
		          	</tr>
		          	<s:set name="num" value="0"></s:set>
		          	<s:iterator value="customers">
	          			<tr bgcolor="#e7e7e7"> 
				            <td width="5%" align="center">
				            	<input name="id" type="checkbox" id="id" value="new1">
				            </td>
				            <td width="25%"><s:property value="name" /></td>
				            <td width="25%"><s:property value="company" /></td>
				            <td width="25%"><s:property value="position" /></td>				          				            
				            <td align="center" width="30%">
				            	<img hspace="5" align="absmiddle" src="${pageContext.request.contextPath}/images/admin/delenews.gif" /><a href='<s:url value="deletecustomer.action"><s:param name="customerId" value="id"/></s:url>' >删除</a>
				            	<img hspace="5" align="absmiddle" src="${pageContext.request.contextPath}/images/admin/setuser.gif" /><a href='<s:url value="editcustomer.action"><s:param name="customerId" value="id"/></s:url>' >修改</a>
				            </td>
	          			</tr>
          			</s:iterator>
          		  	<tr> 
            			<td colspan="7" align="center"> <hr width="95%" style="color:#669900"></td>
          			</tr>
          			<tr>
          				<td class="page_style" colspan="7" align="right">
          					<span class="page-navi-count">
								<a href="#" id="Previous">&lt;&lt;Previous</a>
								<s:set var="currentPage" value="0" /> 
				  				<s:iterator value="%{pager.pageNums}">
									<a href="<s:url value='maintaincustomers.action'><s:param name='currentPage' value='%{#currentPage}'/></s:url>" id="pager">
										<s:property value="%{pager.pageNums[#currentPage]}" />
									</a>
									<s:set var="currentPage" value="%{#currentPage+1}" />
								</s:iterator> 
								<a href="#" id="Next">Next&gt;&gt;</a> 
							</span> 
          				</td>
          			</tr>
        		</table>
      		</td>
    	</tr>
  	</table>
</s:form>
</body>
</html>